﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class test_Prueba :  ObjectPage
{
    Encripta enc = new Encripta();
    protected void Page_Load(object sender, EventArgs e)
    {
        Encripta enc = new Encripta();
        //DataTable dt = ListarUsuario("","US", "A", 0);
 
        //List<BEEntidadString> lst = new List<BEEntidadString>();
        
        

        //foreach (DataRow dr in dt.Rows)
        //{
        //    BEEntidadString be = new BEEntidadString();
        //    be.Valor = dr["CodigoUsuario"].ToString();
        //    be.Descripcion = enc.EncriptarCadena(enc.DesencriptarSpring(dr["Clave"].ToString()));
        //    lst.Add(be);
        //}

        //GridView1.DataSource = lst;
        //GridView1.DataBind();

    }


    /// <summary>
    /// Método Lista Niveles de Alerta
    /// </summary>
    /// <returns>Devuelve un DataSet</returns>
    protected DataTable ListarUsuario(string pstrNombre, string pstrTipo, string pstrEstado, int pintPagina)
    {

        WCUsuario.BEUsuario be = new WCUsuario.BEUsuario();
        be.Nombre = pstrNombre;
        be.Tipo = pstrTipo;
        be.Estado = pstrEstado;
        be.Pagina = pintPagina;
        DataTable dt = new DataTable();
        using (var client = new ServiceClient<WCUsuario.IWCUsuario>("BasicHttpBinding_IWCUsuario"))
        {
            var response = client.ServiceOperation<DataTable>(
               c => c.Listar(be).Tables[0]
               );
            ;
            dt = response;
        }
        return dt;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        TextBox2.Text = enc.EncriptarSpring(TextBox1.Text.Trim());
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox2.Text = enc.DesencriptarSpring(TextBox1.Text.Trim());
    }

    protected void Button3_Click(object sender, EventArgs e)
    {
        TextBox4.Text = enc.EncriptarCadena(TextBox3.Text.Trim());
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        TextBox4.Text = enc.DesencriptarCadena(TextBox3.Text.Trim());
    }
}